package com.hui.security.app.service.impl;

import com.hui.security.app.entity.App;
import com.hui.security.app.mapper.AppMapper;
import com.hui.security.app.service.AppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <b><code>AppServiceImpl</code></b>
 * <p/>
 * Description:
 * <p/>
 * <b>Creation Time:</b> 2019/1/22 16:16.
 *
 * @author Hu weihui
 */
@Service
public class AppServiceImpl implements AppService {
    @Autowired
    private AppMapper appMapper;

    /**
     * Add app.
     *
     * @param app the app
     * @return the app
     * @author : Hu weihui
     * @since hui_project v1
     */
    @Override
    public App add(App app) {
        appMapper.insertSelective(app);
        return app;
    }

    /**
     * Delete.
     *
     * @param appId the app id
     * @author : Hu weihui
     * @since hui_project v1
     */
    @Override
    public void delete(String appId) {
        appMapper.deleteByPrimaryKey(appId);
    }

    /**
     * Update.
     *
     * @param app the app
     * @author : Hu weihui
     * @since hui_project v1
     */
    @Override
    public void update(App app) {
        appMapper.updateByPrimaryKeySelective(app);
    }

    /**
     * Get app.
     *
     * @param appId the app id
     * @return the app
     * @author : Hu weihui
     * @since hui_project v1
     */
    @Override
    public App get(String appId) {
        return appMapper.selectByPrimaryKey(appId);
    }

    /**
     * List app list.
     *
     * @param appName
     * @return the list
     * @author : Hu weihui
     * @since nile -cmszbs-szcst 0.1.0
     */
    @Override
    public List<App> listApp(String appName) {
        return appMapper.selectByName(appName);
    }

}
